package main

import (
	"fmt"
	"sync"
)

type Cache struct {
	sync.Mutex
	mapping map[string]string
}

var cache Cache

func init() {
	cache = Cache{
		mapping: make(map[string]string),
	}
}

func (c *Cache) to(key string) string {
	return c.mapping[key]
}

func Lookups(key string) string {
	cache.Lock()
	v := cache.mapping[key]
	cache.Unlock()
	return v
}

func main() {
	cache.mapping["hello"] = "world"
	fmt.Println(Lookups("hello"))
	fmt.Printf(cache.to("hello"))
}
